// miniprogram/pages/showView/signUp/shareActivity.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show_canvas: false,
    wei_canvas_data: {
      top_bg: "",
      title: "青青女子会所",
      qrcode: "",
      position:'美容师',
      salary:'3000-8000元/月',
      shop_name: "招聘职位:"
    },
    canvasSrc: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.hideShareMenu()//隐藏转发按钮
    let wei_canvas_data = JSON.parse(options.canvasData)
    console.log('--------------------444----------------')
    console.log(wei_canvas_data)
    this.setData({
      wei_canvas_data: wei_canvas_data
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },


  /**
   * canvas组件与page之间数据传递函数
   * 传递的是canvas生成的image
   * **/
  showCanvas: function (e) {
    console.log('------------------------------canvasshow----------------------')
    console.log(e)
    console.log(e.detail.canvas_image_data)
    let that = this;
    that.setData({
      canvasSrc: e.detail.canvas_image_data,
    })
  },

  /**
   * 点击保存图片
   * 获取组件
   * 找到组件内的事件saveCanvasImg
   * **/
  save_canvas_btn: function () {
    let that = this;
    that.canvas_component = that.selectComponent("#wei_canvas_component");
    that.canvas_component.saveCanvasImg();
  },

  /**
   * 长按保存图片
   * 获取组件
   * 找到组件内的事件longTap
   * **/
  longtap_save_img: function () {
    let that = this;
    that.canvas_component = that.selectComponent("#wei_canvas_component");
    that.canvas_component.longTap();
  }
})